From 2e2336ffce5e0a3eae0059babfc36a9668166fe3 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 18 Jul 2020 11:51:45 -0400 Subject: [PATCH] text: Claim clicks when grabbing focus If we don't, an ancestor (such a GtkListItemWidget) may interpret the click as "I should grab focus!", and still our focus away. This was causing hard-to-focus entries in the property list in the inspector. --- gtk/gtktext.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 3dda4162cd..7e91afffab 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -2681,6 +2681,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, { priv->in_click = TRUE; gtk_widget_grab_focus (widget); + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); priv->in_click = FALSE; } @@ -2689,6 +2690,7 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, if (gdk_event_triggers_context_menu (event)) { gtk_text_do_popup (self, widget_x, widget_y); + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); } else if (n_press == 1 && button == GDK_BUTTON_MIDDLE && get_middle_click_paste (self)) @@ -2702,6 +2704,8 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, { gtk_widget_error_bell (widget); } + + gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED); } else if (button == GDK_BUTTON_PRIMARY) { @@ -2821,13 +2825,9 @@ gtk_text_click_gesture_pressed (GtkGestureClick *gesture, gtk_text_set_positions (self, end, start); } - gtk_text_update_handles (self); } - if (button != GDK_BUTTON_PRIMARY || n_press >= 3) - gtk_gesture_set_state (priv->drag_gesture, GTK_EVENT_SEQUENCE_CLAIMED); - if (n_press >= 3) gtk_event_controller_reset (GTK_EVENT_CONTROLLER (gesture)); } -- 2.30.2